package mobi.greenplate.client.service.response;

import java.io.InputStream;
import mobi.greenplate.client.connect.DefaultResponseHandler;
import mobi.greenplate.client.domain.Address;
import mobi.greenplate.client.handler.AddressHandler;
import mobi.greenplate.client.parser.DomainParser;

/**
 *
 * @author dmakariev
 */
public class AddressResponseHandler extends DefaultResponseHandler {

    private Address address;

    @Override
    public void handleContent(InputStream inputStream, long contentLength) {
        final AddressHandler addressHandler = new AddressHandler();
        final DomainParser<Address> addressParser = DomainParser.newInstance(addressHandler);
        this.address = addressParser.parse(inputStream);
    }

    public Address getAddress() {
        return address;
    }
}
